//
//  XMLVisitorAppointDetailModel.m
//  ppkc2016
//
//  Created by 拼凑的断音 on 16/4/13.
//  Copyright © 2016年 拼凑的断音. All rights reserved.
//

#import "XMLVisitorAppointDetailModel.h"
#import "XXTool.h"

@implementation XMLVisitorAppointDetailModel

+(void)requestVistorLiuyanDetailWithAppointmentId:(NSInteger)count ID:(NSString *)apID completion:(void (^)(BOOL, XMLVisitorAppointDetailModel * data,NSMutableArray <LiuyanDetailModel*> *dataList))block{
    [DKHTTPRequest sendNewDataWithShortUrl:@"gz_mess_detail_2017_"
                                  Param:[XXTool formatStringWithLanguage:[NSString stringWithFormat:@"userid=%@&passwd=%@&orderid=%@&nstart=%ld&ntotal=10",[UserInfo shareUserInfo].userID,[UserInfo shareUserInfo].userPassword,apID,(long)count]]
                             ImageArray:nil
                                TimeOut:10
                             Completion:^BOOL(NSMutableDictionary *serverDic, DKHTTPResponseType bufferType) {
                                 if ([[serverDic objectForKey:@"code"] intValue]==200)
                                 {
                                      NSMutableArray *dataList = [[NSMutableArray alloc] init];
                                     NSArray *list = [serverDic objectForKey:@"detail_list"];
                                     for (int i=0; i<list.count; i++)
                                     {
                                         LiuyanDetailModel *temp = [LiuyanDetailModel modelWithDictionary:list[i]];
                                         [dataList addObject:temp];
                                     }
                                     block(YES,[XMLVisitorAppointDetailModel modelWithDictionary:serverDic],dataList);
                                 }
                                 else
                                 {
                                     block(NO,nil,nil);
                                     
                                 }
                                 return YES;
                             } IsBuffering:NO
                      IsNeedReplaceWrap:NO
                        IsUseUpLoadHead:NO];
}

+(void)requestVistorAppintDetailWithAppointmentId:(NSString *)apID completion:(void (^)(BOOL, XMLVisitorAppointDetailModel *))block
{
    [DKHTTPRequest sendDataWithShortUrl:@"msg_usr_yydetail"
                                  Param:[XXTool formatStringWithLanguage:[NSString stringWithFormat:@"userid=%@&passwd=%@&orderid=%@",[UserInfo shareUserInfo].userID,[UserInfo shareUserInfo].userPassword,apID]]
                             ImageArray:nil
                                TimeOut:10
                             Completion:^BOOL(NSMutableDictionary *serverDic, DKHTTPResponseType bufferType) {
                                 if ([[serverDic objectForKey:@"code"] intValue]==200)
                                 {
                                     block(YES,[XMLVisitorAppointDetailModel modelWithDictionary:serverDic]);
                                 }
                                 else
                                 {
                                     block(NO,nil);
                                    
                                 }
                                 return YES;
                             } IsBuffering:NO
                      IsNeedReplaceWrap:YES
                        IsUseUpLoadHead:NO];
}

@end
